﻿using System.Web.Mvc;
using System.Web.Mvc.Html;
using VideoSeller.Core.Configuration;
using VideoSeller.Core.Interfaces;

namespace VideoSeller.Business.Extensions
{
	public static class ScriptExtension
	{
        private static string _mainWebPath = "";
		public static string GetMainWebPath(this HtmlHelper helper)
		{
           // if (_mainWebPath == "")
            {   
                if (System.Web.HttpContext.Current.Request.Url.ToString().ToUpper().Contains("LOCALHOST"))
                    _mainWebPath = "http://localhost:9813/"; /*Hapaniuk change 27.08.2013*/
                else
                {
                    var databaseSettingsProvider = IoC.Resolve<IDatabaseSettingsProvider>();
                    _mainWebPath = databaseSettingsProvider.MainWebPath;
                }
            }
			return _mainWebPath;
		}
	}
}